home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12556 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: druid.borland.com!usenet
  2. From: pete@borland.com (Pete Becker)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: MS VC++ 4.0 namespace weirdness
  5. Date: 20 Mar 1996 15:46:15 GMT
  6. Organization: Borland International
  7. Message-ID: <4ip987$aj5@druid.borland.com>
  8. References: <314D9E46.433@lydian.lc.att.com>
  9. NNTP-Posting-Host: pbecker.borland.com
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=ISO-8859-1
  12. X-Newsreader: WinVN 0.99.5
  13.  
  14. In article <314D9E46.433@lydian.lc.att.com>, shaw@lydian.lc.att.com says...
  15. >
  16. >[Hope this is the right group -- didn't see a VC++-specific one]
  17. >
  18. >If I define a namespace in an include file, the classes within 
  19. >that
  20. >namespace are not recognized by the MS VC++ 4.0 class window.  
  21. >If I
  22. >define the namespace in the including file, they are.  Any 
  23. >opinions
  24. >on this anomaly?
  25. >
  26. >        Thanks,
  27. >                andrew.shaw@att.com
  28. >
  29. >Example:
  30. >
  31. >// foo1.hpp
  32. >namespace FOO1
  33. >{
  34. >class X1 { int x1; };
  35. >}
  36. >
  37. >// foo2.hpp
  38. >class X2 { int x2; };
  39. >
  40. >// foo.cpp
  41. >#include "foo1.hpp"     // whereis FOO1::X1?
  42. >namespace FOO2
  43. >{
  44. >#include "foo2.hpp"     // FOO2::X2 no problem
  45. >}
  46.  
  47. Don't do this. I know, Microsoft recommends this as the technique for getting 
  48. the public domain version of STL that they slapped onto their CD into a 
  49. namespace. Bottom line is it doesn't work, and it will cause endless problems. 
  50. If the header wasn't written with namespaces in mind don't try to force it into 
  51. a namespace. Namespaces are not something you throw in, they're something you 
  52. design in. If the design isn't there it's not going to work.
  53.  
  54.